package com.wenxixuanwu.fruitstore.service.impl;

import com.wenxixuanwu.fruitstore.entity.OrderListVO;
import com.wenxixuanwu.fruitstore.mapper.BackOrderMapper;
import com.wenxixuanwu.fruitstore.service.BackOrderService;
import com.wenxixuanwu.fruitstore.service.exception.ProductNotFundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author :小凡凡
 * @version :1.0
 * @Project :fruitstore
 * @Date :2022/5/5
 */
@Service
public class BackOrderServiceImpl implements BackOrderService {

    @Autowired
    private BackOrderMapper orderMapper;

    @Override
    public List<OrderListVO> findOrderAll() {
        List<OrderListVO> result = orderMapper.findOrderAll();
        if (result == null){
            throw new ProductNotFundException("订单信息未找到！");
        }
        return result;
    }

    @Override
    public Integer updateStateById(String oId) {
        return orderMapper.updateStateById(oId);
    }

    @Override
    public Integer orderDelete(String oId) {
        return orderMapper.orderDelete(oId);
    }
}
